package com.hmall.common.client;

import com.hmall.common.dto.PageDTO;
import com.hmall.common.dto.SearchDTO;
import com.hmall.common.pojo.Item;
import com.hmall.common.vo.SearchVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


@FeignClient("itemservice")
@RequestMapping("/item")
public interface ItemClient {

    @GetMapping("/{id}")
    Item getItemById(@PathVariable Long id);

    @PutMapping("/stock/{itemId}/{num}")
    void deductStock(@PathVariable Long itemId, @PathVariable Integer num);

    @PostMapping("filters")
    SearchVO filter(@RequestBody SearchDTO searchDTO);

    @PostMapping("list")
    PageDTO<Item> list(@RequestBody SearchDTO searchDTO);

}
